package org.come.control;

import org.come.action.FromServerAction;
import org.come.bean.RoleMoveBean;
import org.come.until.GsonUtil;

import com.tool.image.ImageMixDeal;
import com.tool.image.ManimgAttribute;

public class MoveControl implements FromServerAction {
	@Override
	public void controlMessFromServer(String mes, String type) {
		String []mes11=mes.split("-");
		if ("guiwei".equals(mes11[0])){

			ManimgAttribute attribute = ImageMixDeal.Playerimgmap.get(mes11[1]);
			if (attribute!=null){
				attribute.getRoleShow().setX(Integer.parseInt(mes11[3]));
				attribute.getRoleShow().setY(Integer.parseInt(mes11[4]));
				attribute.getRoleShow().setMapid(Long.parseLong(mes11[2]));
			}
			return;
		}
		// TODO Auto-generated method stub
		RoleMoveBean bean = GsonUtil.getGsonUtil().getgson().fromJson(mes, RoleMoveBean.class);
		// 画出移动的人物（其他玩家）
		if (bean.getRole() != null) {
			ManimgAttribute attribute = ImageMixDeal.Playerimgmap.get(bean.getRole());
			if (attribute != null) {
				attribute.setMovejiange(0);
				attribute.getRoleShow().setX(bean.getPaths().get(0).getX());
				attribute.getRoleShow().setY(bean.getPaths().get(0).getY());
				attribute.getRoleShow().setPlayer_Paths(bean.getPaths());
			}
		}
	}
}
